package com.chia.multienty.workflow.service.impl;

import com.chia.multienty.core.parameter.workflow.FlowableMembershipAddParameter;
import com.chia.multienty.core.parameter.workflow.FlowableMembershipDeleteParameter;
import com.chia.multienty.workflow.service.FlowableMembershipService;
import lombok.RequiredArgsConstructor;
import org.flowable.engine.IdentityService;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class FlowableMembershipServiceImpl implements FlowableMembershipService {
    private final IdentityService identityService;

    @Override
    public void add(FlowableMembershipAddParameter parameter) {
        identityService.createMembership(parameter.getUserId(), parameter.getGroupId());
    }
    @Override
    public void delete(FlowableMembershipDeleteParameter parameter) {
        identityService.deleteMembership(parameter.getUserId(), parameter.getGroupId());
    }
}
